<template>
  <div style="background-color: #EBEBEB;min-height:600px">
    <div style="width:100%;height:80px;background-color: #3399FF; overflow: hidden;" :style="note">
      <span
        class="demonstration"
        style="float:left;padding-top:10px;color:white;margin-left:1%;margin-top:1.3%"
      >东软汽车制造业财务系统</span>
      <!-- <span class="demonstration" style="float:left;padding:5px;color:white;margin-left:2%;width:15%">
                <el-input
                    placeholder="请输入"
                    icon="search"
                    v-model="searchCriteria"
                    :on-icon-click="handleIconClick">
                </el-input>
      </span>-->
      <span class="demonstration" style="float:right;padding-top:10px;margin-right:1%;margin-top:1.3%">
        <el-dropdown trigger="click" @command="handleCommand">
          <span class="el-dropdown-link" style="color:white;margin-top:1.3%">
            {{''+username}}
            <i class="el-icon-caret-bottom el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown" >
            <!-- <el-dropdown-item>个人信息</el-dropdown-item> -->
            <el-dropdown-item command="a">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </span>
    </div>

    <div style="margin-top:5px;">
      <el-row :gutter="10">
        <el-col :xs="4" :sm="4" :md="4" :lg="4" style="position:absolute; background:#fff; height: 100%;">
          <div style="backgroud:red;">
            <el-menu
              default-active="1"
              style="min-height:900px;"
              class="el-menu-vertical-demo"
              @open="handleOpen"
              @close="handleClose"
              :collapse="isCollapse"
              @select="handleSelect"
            >
              <el-menu-item index="1">
                <i class="el-icon-menu"></i>
                <span slot="title">产品存销表</span>
              </el-menu-item>
              <el-submenu index="2">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span slot="title">财务报表</span>
                </template>
                <el-menu-item index="2-1">资产负债所有者权益表</el-menu-item>
                <el-menu-item index="2-2">利润总额和营业收入表</el-menu-item>
                <el-menu-item index="2-3">营业总成本表</el-menu-item>
              </el-submenu>
              <el-menu-item index="3">
                <i class="el-icon-setting"></i>
                <span slot="title">总体盈利分析</span>
              </el-menu-item>
            </el-menu>
          </div>
        </el-col>
        <el-col :xs="20" :sm="20" :md="20" :lg="20" style="margin-left: 280px;">
          <div></div>

          <div style="margin-top:10px">
            <router-view ></router-view>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
export default {
  data () {
    return {
      // css
      note: {
        backgroundImage: 'url(' + require('../../assets/backImage2.jpg') + ')'
      },
      username: ''
    }
  },
  mounted () {
    // mounted--钩子函数，一来到该页面即执行，这里面让其执行init()函数。
    this.$router.push('/prdcount')
    this.username = sessionStorage.username
  },
  methods: {
    handleIconClick (ev) {
      console.log(ev)
    },
    handleCommand (command) {
      this.$router.push('/Login')
    },
    handleSelect (key, keyPath) {
      switch (key) {
        case '1':
          this.$router.push('/prdcount')
          break
        case '2-1':
          this.$router.push('/asset')
          break
        case '2-2':
          this.$router.push('/earn')
          break
        case '2-3':
          this.$router.push('/chengben')
          break
        case '3':
          this.$router.push('/totalyingli')
          break
      }
    }
  }
}
</script>
